<template>
  <div class="Box1 fx-flex fx-flex-direction">
    <div class="fx_title">机械登记情况</div>
    <div class="chartBox fx-flex  fx-flex-direction fx-flex-1" v-if="isShow">
      <div class="desc fx-flex">
        <div class="detail fx-flex-1">
          <div class="label">登记数</div>
          <div class="value">205</div>
        </div>
        <div class="detail fx-flex-1">
          <div class="label">待发放数</div>
          <div class="value">152</div>
        </div>
        <div class="detail fx-flex-1">
          <div class="label">已发放数</div>
          <div class="value">53</div>
        </div>
      </div>
      <div class="chart fx-flex  fx-flex-1">
        <div class="box   fx-flex-1">
          <ChartsView ref="rightChart1" class="fx-flex-1"></ChartsView>
        </div>
        <div class="box fx-flex-1">
          <ChartsView ref="rightChart2" class="fx-flex-1"></ChartsView>
        </div>
        <div class="box fx-flex-1">
          <ChartsView ref="rightChart3" class="fx-flex-1"></ChartsView>
        </div>
      </div>

    </div>
    <NoData class="fx-flex-1" v-else></NoData>
  </div>
</template>
<script>
import ChartsView from "../charts.vue";
export default {
  name: "Box1",
  components: {
    ChartsView,
    NoData: () => import("../nodata.vue"),
  },
  data() {
    return {
      isShow: true,
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.getData();
    });
  },
  methods: {
    getData() {
      let option1 = {
        series: [
          {
            type: "gauge",
            center: ["50%", "60%"],
            radius: "73%",
            startAngle: 210,
            endAngle: -30,
            splitNumber: 100 / 20,
            itemStyle: {
              color: "#58D9F9", //指针颜色
              shadowColor: "rgba(0,138,255,0.45)",
              shadowBlur: 5,
              shadowOffsetX: 2,
              shadowOffsetY: 2,
            },
            pointer: {
              length: "40%",
              width: 2,
              // offsetCenter: [0, 50],
            },
            progress: {
              show: true,
              width: 5,
              roundCap: true,
              itemStyle: {
                color: "#00A8FF", //进度条颜色
              },
            },
            axisLine: {
              roundCap: true,
              lineStyle: {
                width: 5,
              },
            },
            axisTick: {
              distance: 0,
              splitNumber: 2,
              lineStyle: {
                width: 1,
                color: "#888",
              },
            },
            splitLine: {
              length: 0,
              lineStyle: {
                width: 1,
                color: "#888",
              },
            },
            axisLabel: {
              distance: 2,
              color: "#888",
              fontSize: 10,
            },
            anchor: {
              show: false,
            },
            title: {
              show: true,
              offsetCenter: [0, "-123%"], //设置完成率位置
              rich: {
                a: {
                  color: "rgba(0, 168, 255, 1)",
                  lineHeight: 6,
                  fontSize: 16,
                },
                b: {
                  color: "rgba(255,255,255,0.65)",
                  lineHeight: 6,
                  fontSize: 16,
                },
              },
            },
            detail: {
              valueAnimation: true,
              offsetCenter: [0, "70%"],
              formatter: function (value) {
                return "{value|" + value.toFixed(0) + "%}";
              },
              rich: {
                value: {
                  fontSize: 18,
                  fontWeight: "bold",
                  color: "#fff",
                  padding: [0, 0, -10, 10],
                },
              },
            },
            data: [
              {
                value: 50,
                name: `{a|${75}}{b| / ${150}}`,
              },
            ],
          },
        ],
      };
      this.$refs.rightChart1.setOption(option1);
      this.$refs.rightChart2.setOption(option1);
      this.$refs.rightChart3.setOption(option1);
    },
  },
};
</script>
<style lang="scss" scoped>
.Box1 {
  position: relative;
  .chartBox {
    position: relative;
    .desc {
      background: #35424a;
      width: 90%;
      height: 60px;
      line-height: 30px;
      padding: 10px;
      margin: 0 auto;
      .detail {
        height: 100%;
        text-align: center;
        .label {
          font-size: 14px;
        }
        .value {
          color: #7bf8ab;
          font-size: 20px;
        }
      }
    }
  }
}
</style>